#include<iostream>
#include<stdlib.h>
using namespace std;
class Clock{
      private:
              int h,m,s;
      public:
             Clock();
             Clock(int, int, int);
             void Nhap();
             void In();
             void LamTron();
             Clock Cong(int);
            
};
Clock::Clock(){
               h=m=s=0;               
}
Clock::Clock(int a, int b, int c){
                 h=a; m=b; s=c;                 
}
void Clock::Nhap(){
              cout<<"Nhap gio: "; cin>>h;
              cout<<"Nhap phut: "; cin>>m;
              cout<<"Nhap giay: "; cin>>s;
}
void Clock::LamTron(){
     m=m+s/60;
     h=h+m/60;
     s=s%60;
     m=m%60;
     h=h%24;     
}
Clock Clock::Cong(int n){
      m=m+n;
      return *this;
}
void Clock::In(){
            cout<<h<<":"<<m<<":"<<s;            
}
int main(){
    Clock a(9,15,38);
    cout<<"Clock a khoi tao: "; a.In();
    Clock b;
    cout<<endl<<"Nhap Clock b: "; b.Nhap();
    cout<<"Gia tri Clock b "; b.In();
    b.Cong(45); b.LamTron();
    cout<<endl<<"Clock b sau khi cong 45 phut la: "; b.In();
    cout<<endl;
    system("pause");    
    return 0;
}
